package com.example.pre.service.impl;

import java.util.Collection;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.example.pre.dao.UserDao;
import com.example.pre.model.User;
import com.example.pre.service.UserService;

/*
 * 用户service实现类
 */
@Service
public class UserServiceImpl implements UserService {

	@Autowired
	private UserDao userDao;

	@Override
	public User get(int id) {
		return userDao.get(id);
	}

	@Override
	public Collection<User> getAll() {
		return userDao.listByCondition(null);
	}

	@Override
	public boolean update(User user) {
		return userDao.update(user) == 1;
	}

	@Override
	public boolean delete(int id) {
		return userDao.delete(id) == 1;
	}

	@Override
	public boolean create(User user) {
		return userDao.create(user) == 1;
	}

	@Override
	public Collection<User> listByCondition(Map<String, Object> whereColumn) {
		return userDao.listByCondition(whereColumn);
	}

	@Override
	public int countByCondition(Map<String, Object> whereColumn) {
		return userDao.countByCondition(whereColumn);
	}

}
